<?php

/*

Update Disply Name (update_display_name.php)

*/

$page_title = "Update Display Name";
$rank_check = 1;
include "header.inc.php";

if (!$getInfo[premium] == 1)
{
	die(header(error("update_profile.php?game=$game", "You must have a <a href=upgrade.php?game=$game>premium</a> account to use that feature.")));
}

print "$openHTML";

$findProfile = fetch("SELECT * FROM members_profiles2 WHERE username = '$username' AND game = '$game'");

if ($page == "update")
{
	$displayNameChange = eregi_replace("\(red\)", "<FONT COLOR=#FF0000>", $displayNameChange);
	$displayNameChange = eregi_replace("\(orange\)", "<FONT COLOR=#FFCC00>", $displayNameChange);
	$displayNameChange = eregi_replace("\(yellow\)", "<FONT COLOR=#FFFF00>", $displayNameChange);
	$displayNameChange = eregi_replace("\(green\)", "<FONT COLOR=#00CC00>", $displayNameChange);
	$displayNameChange = eregi_replace("\(blue\)", "<FONT COLOR=#0000FF>", $displayNameChange);
	$displayNameChange = eregi_replace("\(indigo\)", "<FONT COLOR=#CCFFFF>", $displayNameChange);
	$displayNameChange = eregi_replace("\(violet\)", "<FONT COLOR=#9966FF>", $displayNameChange);
	$displayNameChange = eregi_replace("\(endcolor\)", "</FONT>", $displayNameChange);
	$displayNameChange = eregi_replace("\(b\)", "<b>", $displayNameChange);
	$displayNameChange = eregi_replace("\(endb\)", "</b>", $displayNameChange);
	$displayNameChange = eregi_replace("\(u\)", "<u>", $displayNameChange);
	$displayNameChange = eregi_replace("\(endu\)", "</u>", $displayNameChange);
	$displayNameChange = eregi_replace("\(i\)", "<i>", $displayNameChange);
	$displayNameChange = eregi_replace("\(endi\)", "</i>", $displayNameChange);
	$displayNameChange2 = strip_tags($displayNameChange,"");
	if ($displayNameChange2 != $display_name)
	{
		die("<p>There was an error with your code, please go back double check it.</p>$closeHTML");
	}
	mysql_query("UPDATE members2 SET display_prem = '$displayNameChange' WHERE game = '$game' AND id = '$userid' AND premium = '1'");
}

$getInfo2 = fetch("SELECT * FROM members2 WHERE username = '$username' AND game = '$game'");

if (!$getInfo2[display_prem]) { $getInfo2[display_prem] = $display_name; }

print "<FORM ACTION=\"update_display_name.php?game=$game&page=update\" METHOD=POST><Center><p>$getInfo2[display_prem]<Br>";

$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#FF0000>", "(red)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#FFCC00>", "(orange)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#FFFF00>", "(yellow)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#00CC00>", "(green)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#0000FF>", "(blue)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#CCFFFF>", "(indigo)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<FONT COLOR=#9966FF>", "(violet)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("</FONT>", "(endcolor)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<b>", "(b)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("</b>", "(endb)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<u>", "(u)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("</u>", "(endu)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("<i>", "(i)", $getInfo2[display_prem]);
$getInfo2[display_prem] = eregi_replace("</i>", "(endi)", $getInfo2[display_prem]);

ECHO <<<END

<TEXTAREA NAME=displayNameChange ROWS=5 COLS=64 WRAP=virtual>$getInfo2[display_prem]</TEXTAREA><BR>
<INPUT TYPE=submit NAME=Submit VALUE="Change Display Name"></p><p>DO NOT add spaces, extra letters, or extra numbers. ONLY add the codes listed below.</p></center>

<CENTER><TABLE BGCOLOR="#3399FF" CELLSPACING=1 CELLPADDING=0 WIDTH=400>
   <TR BGCOLOR="#99CCFF">
      <TD>
         <CENTER><FONT SIZE="-1"><B>Code</B></FONT>

         <P><FONT SIZE="-1">(red)<BR>
         (orange)<BR>
         (yellow)<BR>
         (green)<BR>
         (blue)<BR>
         (indigo)<BR>
         (violet)<BR>
         (endcolor)<BR>
         (b)<BR>
         (endb)<BR>
         (u)<BR>
         (endu)<BR>
         (i)<BR>
         (endi)</FONT></P></CENTER>
      </TD>
      <TD>
         <CENTER><FONT SIZE="-1"><B>Displays</B></FONT>

         <P><FONT SIZE="-1" COLOR="#FF0000">Red Text<BR>
         </FONT><FONT SIZE="-1" COLOR="#FFCC00">Orange Text<BR>
         </FONT><FONT SIZE="-1" COLOR="#FFFF00">Yellow Text<BR>
         </FONT><FONT SIZE="-1" COLOR="#00CC00">Green Text<BR>
         </FONT><FONT SIZE="-1" COLOR="#0000FF">Blue Text<BR>
         </FONT><FONT SIZE="-1" COLOR="#CCFFFF">Indigo text<BR>
         </FONT><FONT SIZE="-1" COLOR="#9966FF">Violet Text<BR>
         </FONT><FONT SIZE="-1">Ends most recent color change<BR>
         <U>Shows Underlined Text<BR>
         </U>Ends Underlined Text<BR>
         <B>Shows Bold Text<BR>
         </B>Ends Bold Text<BR>
         <I>Shows Italic Text<BR>
         </I>Ends Italic Text</FONT></P></CENTER>
      </TD>
   </TR>
</TABLE>

<P>Example:</P>

<P>&#91;color
red&#93;St&#91;underline&#93;ev&#91;endcolor&#93;&#91;color
blue&#93;e&#91;endcolor&#93;&#91;endunderline&#93;<BR>
&#91;bold&#93;is&#91;endbold&#93; &#91;italic&#93;co&#91;color
green&#93;ol&#91;endcolor&#93;42&#91;enditalic&#93;</P>

<P>Shows:</P>

<P><FONT COLOR="#FF0000">St<U>ev</U></FONT><FONT COLOR="#0000FF"><U>e</U>
</FONT><B>is</B> <I>co</I><FONT COLOR="#00CC00"><I>ol</I></FONT><I>42</I></P></CENTER>

END;

print "$closeHTML";
?>